main(m,n,r){char a[100],b[100];for(gets(a);~scanf("%s%s",a,b);){m=strlen(a);n=strlen(b);m=m>n?m:n;for(r=n=0;n<m;n++)r+=pow((a[n]?a[n]-64:0)-(b[n]?b[n]-64:0),2);printf("%d\n",r/m);}}
